home *** CD-ROM | disk | FTP | other *** search
/ Java for 3D & VRML Worlds / Java for 3d and VRML Worlds.iso / examples / chap05 / ColorTester.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-10-08  |  2.4 KB  |  94 lines

  1. import vrml.Event;
  2. import vrml.field.ConstSFBool;
  3. import vrml.field.SFColor;
  4. import vrml.field.SFFloat;
  5. import vrml.field.SFNode;
  6. import vrml.node.Node;
  7. import vrml.node.Script;
  8.  
  9. public class ColorTester extends Script {
  10.    ColorPanel panel;
  11.    SFFloat a_field;
  12.    SFFloat s_field;
  13.    SFFloat t_field;
  14.    SFColor dc_field;
  15.    SFColor ec_field;
  16.    SFColor sc_field;
  17.  
  18.    public void initialize() {
  19.       Node var1 = (Node)((SFNode)((Script)this).getField("target")).getValue();
  20.       this.panel = new ColorPanel(this);
  21.       this.a_field = (SFFloat)var1.getExposedField("ambientIntensity");
  22.       this.dc_field = (SFColor)var1.getExposedField("diffuseColor");
  23.       this.ec_field = (SFColor)var1.getExposedField("emissiveColor");
  24.       this.s_field = (SFFloat)var1.getExposedField("shininess");
  25.       this.sc_field = (SFColor)var1.getExposedField("specularColor");
  26.       this.t_field = (SFFloat)var1.getExposedField("transparency");
  27.    }
  28.  
  29.    public void processEvent(Event var1) {
  30.       if (var1.getName().equals("entered")) {
  31.          ConstSFBool var2 = (ConstSFBool)var1.getValue();
  32.          if (var2.getValue()) {
  33.             this.panel.map();
  34.             return;
  35.          }
  36.  
  37.          this.panel.hide();
  38.       }
  39.  
  40.    }
  41.  
  42.    public void shutdown() {
  43.       this.panel.dispose();
  44.    }
  45.  
  46.    public float get_ambientIntensity() {
  47.       return this.a_field.getValue();
  48.    }
  49.  
  50.    public void set_ambientIntensity(float var1) {
  51.       this.a_field.setValue(var1);
  52.    }
  53.  
  54.    public void get_diffuseColor(float[] var1) {
  55.       this.dc_field.getValue(var1);
  56.    }
  57.  
  58.    public void set_diffuseColor(float[] var1) {
  59.       this.dc_field.setValue(var1);
  60.    }
  61.  
  62.    public void get_emissiveColor(float[] var1) {
  63.       this.ec_field.getValue(var1);
  64.    }
  65.  
  66.    public void set_emissiveColor(float[] var1) {
  67.       this.ec_field.setValue(var1);
  68.    }
  69.  
  70.    public float get_shininess() {
  71.       return this.s_field.getValue();
  72.    }
  73.  
  74.    public void set_shininess(float var1) {
  75.       this.s_field.setValue(var1);
  76.    }
  77.  
  78.    public void get_specularColor(float[] var1) {
  79.       this.sc_field.getValue(var1);
  80.    }
  81.  
  82.    public void set_specularColor(float[] var1) {
  83.       this.sc_field.setValue(var1);
  84.    }
  85.  
  86.    public float get_transparency() {
  87.       return this.t_field.getValue();
  88.    }
  89.  
  90.    public void set_transparency(float var1) {
  91.       this.t_field.setValue(var1);
  92.    }
  93. }
  94.